//
//  Singleton.hpp
//  DemoV2
//
//  Created by 董一龙 on 2022/8/8.
//

#ifndef Singleton_hpp
#define Singleton_hpp

/**
* @class Singleton
* @brief 懒汉模式线程安全单例模板
* @author yilongdong
* @note
*/
template<typename T>
class Singleton
{
public:
    static T& GetInstance()
    {
        static T instance;
        return instance;
    }

    Singleton(T&&) = delete;
    Singleton(const T&) = delete;
    void operator= (const T&) = delete;

protected:
    Singleton() = default;
    virtual ~Singleton() = default;
};

#endif /* Singleton_hpp */
